home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / COLOR.SWG / 0016_Setting Text Attr.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  653b  |  20 lines

  1. {YZ> Does anyone know how to "extract" the foreground and background
  2. YZ> colours from TextAttr?
  3. }
  4.  
  5.     Foreground := TextAttr and $0f;
  6.     Background := (TextAttr and $f0) shr 4;
  7.  
  8. {A few days ago, I read a message from someone who was trying to extract
  9. foreground and background colors from one Byte Variable. I have since
  10. lost the mail packet, and forgotten the user's name, but here's a
  11. routine that will do that anyways. Hope it gets to the person who was
  12. asking For it......
  13. }
  14. Procedure GetColors(Color : Byte; Var BackGr : Byte; Var ForeGr : Byte);
  15. begin
  16.   BackGr := Color shr 4;
  17.   ForeGr := Color xor (Background shl 4);
  18. end;
  19.  
  20.